/**
 * @license
 * Copyright 2024 The Model Explorer Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ==============================================================================
 */

:host {
  overflow: hidden;
}

.container {
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  position: relative;

  &.has-overflow,
  &.has-multiple-lines {
    cursor: pointer;

    .icon-container {
      display: flex;
    }

    &:hover .icon-container {
      opacity: 1;
    }
  }

  &.has-bg-color {
    border-radius: 4px;
    padding-left: 4px;
  }

  &.expanded {
    .one-line-text {
      position: absolute;
      inset: 0;
      visibility: hidden;
    }

    .expanded-text {
      display: block;
      flex-grow: 1;
      cursor: text;

      .info-msg {
        margin-bottom: 2px;
        color: var(--me-on-surface-low-color);
        font-size: 12px;

        .underline {
          text-decoration: underline dashed;
        }
      }

      .monospace-content {
        font-size: 11px;
        white-space: pre-wrap;
        font-family: monospace;
        max-height: 500px;
        overflow: auto;
      }

      .text-content {
        white-space: pre-wrap;
        max-height: 500px;
        overflow: auto;
      }

      .namespace-content {
        display: flex;
        flex-direction: column;
        gap: 2px;
      }

      .namespace-row {
        font-size: 12px;
        line-height: 14px;
        display: flex;
        align-items: flex-start;

        .index {
          width: 16px;
          color: var(--me-on-surface-variant-color);
          flex-shrink: 0;
          line-height: 14px;
        }

        .namespace {
          line-height: 14px;

          &.hidden {
            color: var(--me-on-surface-variant-color);
          }
        }
      }
    }

    .icon-container {
      background-color: var(--me-surface-container-high-color);
      border: 1px solid var(--me-outline-color);

      mat-icon {
        color: var(--me-on-surface-variant-color);
      }
    }
  }

  .one-line-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .expanded-text {
    display: none;
  }

  .icon-container {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: none;
    background-color: var(--me-secondary-container-color);
    border-radius: 2px;
    margin-left: 2px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--me-on-secondary-container-color);
    opacity: 0.75;

    mat-icon {
      color: var(--me-primary-color);
      font-size: 11px;
      width: 11px;
      height: 11px;
      font-weight: 700;
    }
  }
}
